package com.webservice;
import java.net.URL;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

public class SendLoginService {
	String result;
	 public String sendLogin(String spID, String spPWD, String request)
	    throws Exception
	  {
	    try
	    {
	      //String endpointURL = "http://127.0.0.1:8080/ssom/services/WebServiceCall?wsdl";
	      String endpointURL = "http://10.78.165.10:8080/ssom/services/WebServiceCall?wsdl";
	      Service service = new Service();
	      Call call = (Call)service.createCall();
	      call.setTargetEndpointAddress(new URL(endpointURL));

	      call.setOperationName("process");

	      call.addParameter("spID", 
	        XMLType.XSD_STRING, 
	        ParameterMode.IN);
	      call.addParameter("spPWD", 
	        XMLType.XSD_STRING, 
	        ParameterMode.IN);
	      call.addParameter("request", 
	        XMLType.XSD_STRING, 
	        ParameterMode.IN);

	      call.setReturnType(XMLType.XSD_ANY);

	      result = (String)call
	        .invoke(new Object[] { spID, spPWD, request });
	    }
	    catch (Exception ee)
	    {
	      String result;
	      ee.printStackTrace();
	    }
	    return result;
	  }
	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception 
	{
	    SendLoginService sps = new SendLoginService();
	    sps.sendLogin("1", "1", "getHuman,SystemID,epm");
	  }

}
